![]() |
PATH![]() |
![]() ![]() |
One of the main things that you can do to make your program theme-compliant is to avoid using "fixed" color values for your interface. Instead of hard-coding color values, use the Appearance Manager ThemeBrush constants, described in Theme Brush Constants , for painting the background of a window or control. Theme brushes are an abstract mechanism that allows colors and patterns to be coordinated with the current theme. A theme brush may specify either an RGB color or a pixel pattern, depending on the theme. You can pass constants of type ThemeBrush in the inBrush parameter of the functions SetThemeBackground , SetThemePen , and SetThemeWindowBackground to specify that the Appearance Manager substitute whatever the appropriate color or pattern is for a given human interface element in the current theme. Using these brushes makes your existing user interface integrate more smoothly with the current theme.
The SetThemeBackground function applies a theme-compliant color or pattern to the background of the current graphics port. Your application should call the SetThemeBackground function each time you wish to draw a background in a particular brush type. Note that the SetThemeBackground function aligns patterns with local coordinates (0,0) in the current port. To apply a theme-compliant color or pattern to the foreground of the current port, use the SetThemePen function. Your application should call the SetThemePen function each time you wish to draw a foreground element in a specified brush constant. For use specifically with windows, not ports, the SetThemeWindowBackground function sets the theme-compliant color or pattern value to which the Window Manager erases a window's background.
Because ThemeBrush constants can represent a color or pattern, depending on the current theme, your application must save and restore the current drawing state of the graphics port around calls to SetThemeBackground , SetThemePen , and SetThemeWindowBackground . For details on this process, see Saving and Restoring the Drawing Environment .